#! /usr/bin/perl -w

use Expect;
use strict;

my $timeout = 10;
my $username = "test";
my $password = "test";

my $exp = Expect->spawn("scp", "$0", "$username\@localhost:");
$exp->expect($timeout,
               [ qr/password/i => sub { my $exp = shift;
                                        $exp->send("$password\n");
                                      } ],
            );
$exp->soft_close;
